﻿<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt"  prefix="fmt"%>
<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Studio工作室项目管理</title>
    <link href="../dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="../dist/css/font-awesome.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/dist/css/nprogress.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/dist/css/green.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/dist/css/bootstrap-progressbar-3.3.4.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/dist/css/jqvmap.min.css" rel="stylesheet"/>  
    <link href="${pageContext.request.contextPath }/dist/css/daterangepicker.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/dist/css/custom.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/dist/css/bootstrap-datetimepicker.min.css" rel="stylesheet" media="screen">
    <script src="${pageContext.request.contextPath }/dist/js/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath }/dist/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath }/dist/js/custom.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath }/dist/js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath }/dist/js/bootstrap-datetimepicker.fr.js" charset="UTF-8"></script>
    <style>
    html,body{overflow:hidden;overflow-y:auto;}
    #con{
        height:650px;;
        margin-top:50px;
    }
    td{width: 30px;}
    </style>
    <script type="text/javascript"> 
   function del() {
  var msg = "您真的确定要删除吗？\n\n请确认！";
  if (confirm(msg)==true){
      return true;
  }else
  {
     return false;
  }
   }
   
   function deleteStudent()
   {
     var msg = "您真的确定要删除吗？\n\n请确认！";
    if (confirm(msg)==true){
       document.getElementById("itemForm").action="${pageContext.request.contextPath }/student/deleteStudents" ;
          document.getElementById("itemForm").submit();  
     }
    
         
   }
   function addStudent()
   {
     document.getElementById("itemForm").action="${pageContext.request.contextPath }/student/addStudent" ;
     document.getElementById("itemForm").submit();  
   }
   
</script> 
 </head>
 <body class="nav-md">
    <div class="container body">
      <div class="main_container">
        <div class="col-md-3 left_col">
          <div class="left_col scroll-view">
            <div class="navbar nav_title" style="border: 0;">
              <a href="index.html" class="site_title"><i class="glyphicon glyphicon-flag"></i><span>Studio工作室</span></a>
            </div>
            <div class="clearfix"></div>
            
            <div class="profile clearfix">
              <div class="profile_pic">
                <img src="${pageContext.request.contextPath }/images/img.jpg" alt="..." class="img-circle profile_img">
              </div>
              <div class="profile_info">
                <span>Welcome,</span>
                <h2>John Doe</h2>
              </div>
            </div> <br>

            <!-- sidebar menu -->
            <div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
              
               <div class="menu_section">
                <h3>Live On</h3>
                <ul class="nav side-menu">
                  <li class="active"><a href="${pageContext.request.contextPath }/clazz/clazz"><i class="glyphicon glyphicon-home"></i>班级信息管理</a></li>
                  <li><a href="${pageContext.request.contextPath }/college/college"><i class="glyphicon glyphicon-home"></i> 学院信息管理</a></li>
                  <li><a href="${pageContext.request.contextPath }/student/student"><i class="glyphicon glyphicon-home"></i> 学生信息管理</a></li>
                  <li><a href="${pageContext.request.contextPath }/workGroup/workGroup"><i class="glyphicon glyphicon-home"></i> 项目信息管理</a></li>           
                </ul>
              </div>
              
              
              
              <div class="menu_section">
                    <h3 style="font-size: 20px;">班级</h3>
                </div>
  
                <div class="menu_section" style="margin-left:10px;">
                	
                      <select form="clazzForm" name="clazzId" class="selectpicker col-md-8" >
                      <c:forEach items="${clazzs}" var="item">
                          <option value="${item.clazzId}">${item.clazzName }</option>
                         </c:forEach>
                    </select>
                    
                    <form action="${pageContext.request.contextPath }/student/student" id="clazzForm">
								   <input type="submit">
						</form>
                </div>

                <div class="clearfix"></div>

                <div class="menu_section" >
                    <h3 style="font-size: 20px;margin-top: 60px;" id="downn">项目组</h3>
                </div>

                <div class="menu_section" style="margin-left:10px;margin-top: 50px;">
                    <select form="groupForm" name="groupId" class="selectpicker col-md-8">
                    <c:forEach items="${workGroups}" var="item">
                          <option  value="${item.groupId}" onclick="selectByGroupId()">${item.groupName }</option>
                         </c:forEach>
                         
                    </select>
                    
					<form action="${pageContext.request.contextPath }/student/student" id="groupForm">
								   <input type="submit">
						</form>
                </div>
              
            </div>

            
          </div>
        </div> <!--左边-->
        <div class="top_nav">
          <div class="nav_menu">
            <nav>
              <div class="nav toggle">
              <a id="menu_toggle"><i class="glyphicon glyphicon-align-justify"></i></a></div>
              <ul class="nav navbar-nav navbar-right">
                <li class="dropdown">
                  <a href="#" class="user-profile dropdown-toggle" data-toggle="dropdown">
                    <img src="${pageContext.request.contextPath }/images/img.jpg">John Doe
                    <span class="glyphicon glyphicon-chevron-down"></span>
                  </a>
                </li>
              </ul>
            </nav>
          </div>
        </div><!-- 顶部导航条 -->

        <!-- page content -->
        <div class="right_col" role="main">
            <h3 class=text-center>工作室项目管理</h3>
            <form action="${pageContext.request.contextPath }/student/student" method="get">
            <div class="input-group col-md-3">
                  <input type="text" class="form-control col-sm-6 " placeholder="请输入关键字搜索" name="param" >
              <span class="input-group-addon btn-primary" ><span class="glyphicon glyphicon-search"></span></span>
            </div>
            </form>
            <br>
        </div>
          <!-- /top tiles -->
          <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
              <div class="dashboard_graph">
                <div class="row x_title">
                  <div class="col-md-offset-2">
                    <div class="container" id="con">
                        <div class="row row-centered">
                            <div class="well col-md-12 col-centered">
                                <h3 class="text-center">学生信息列表</h3>
    <div class="btn-toolbar">
      <div class="btn-group">
        <input type="button"  value="删除所选项" onclick="deleteStudent()" class="btn btn-warning" />
      </div>
      <div class="btn-group">
        <input type="button"  value="新增学生"   onclick="addStudent()" class="btn btn-info" />
      </div>
       <div class="btn-group pull-right">
                <a href="${pageContext.request.contextPath }/student/student?sex=0" class="btn btn-warning"  >男</a>
        </div>
        <div class="btn-group pull-right">
            <a href="${pageContext.request.contextPath }/student/student?sex=1" class="btn btn-info"  >女</a>
        </div>
         <div class="btn-group pull-right">
                <a href="${pageContext.request.contextPath }/student/student?state=0"  class="btn btn-warning" >在校</a> 
        </div>
        <div class="btn-group pull-right">
            <a href="${pageContext.request.contextPath }/student/student?state=1"  class="btn btn-info" >毕业</a> 
        </div>
      
    </div>
    <form id="itemForm" action="${pageContext.request.contextPath }/student/addStudent" method="post">
      <table class="table table-bordered table-hover">
        <tr>
          <td>选择</td>
          <td>学生编号</td>
          <td>学生姓名</td>
          <td>所在班级</td>
          <td>phone</td>
          <td>qq</td>
          <td>email</td>
          <td>state</td>
          <td>groupId</td>
          <td>sex</td>
          <th colspan="2">options</th>
        </tr>
        <c:forEach items="${studentList}" var="item">
        <tr>  
          <td><input type="checkbox" name="id" value="${item.id}"/></td>
          <td>${item.studentId }</td>
          <td><a href="${pageContext.request.contextPath }/studentMessage/studentMessage?name=${item.studentName}">${item.studentName}</a></td>
          <td>${item.classId }</td>
          <td>${item.phone }</td>
          <td>${item.qq }</td>
          <td>${item.email }</td>
          <td>${item.state }</td>
          <td>${item.groupId }</td>
          <td>${item.sex }</td>
          <td><a href="${pageContext.request.contextPath }/student/editStudent?id=${item.id}" class="btn btn-primary"><i class="glyphicon glyphicon-edit"></i></a></td>
          <td><a href="${pageContext.request.contextPath }/student/deleteStudent?id=${item.id}" onclick="javascript:return del();" class="btn btn-danger"><i class="glyphicon glyphicon-trash"></i></a></td>  
        </tr>
        </c:forEach>
      </table>
    </form>
    
 
				<!-- 分页 -->
<ul class="pagination" style="margin-left:200px;">
             <div class="divBody">  
  <div class="divContent">
   
    <%--上一页 --%> 
 
<c:choose>  
    <c:when test="${page.pageNum eq 1 }"><span class="spanBtnDisabled">上一页</span></c:when>  
    <c:otherwise><a href="javascript:void(0)" onclick="SetRequest(${page.pageNum-1})" class="aBtn bold">上一页</a></c:otherwise>  
</c:choose>
               <c:choose>  
    <c:when test="${page.tp <= 6 }">  
        <c:set var="begin" value="1"/>  
        <c:set var="end" value="${page.tp }"/>  
    </c:when>  
    <c:otherwise>  
        <c:set var="begin" value="${page.pageNum-2 }"/>  
        <c:set var="end" value="${page.pageNum + 3}"/>  
        <c:if test="${begin < 1 }">  
          <c:set var="begin" value="1"/>  
          <c:set var="end" value="6"/>  
        </c:if>  
        <c:if test="${end > page.tp }">  
          <c:set var="begin" value="${page.tp-5 }"/>  
          <c:set var="end" value="${page.tp }"/>  
        </c:if>         
    </c:otherwise>  
 </c:choose>  

<c:forEach begin="${begin }" end="${end }" var="i">  
   <c:choose>  
      <c:when test="${i eq page.pageNum }">  
        <span class="spanBtnSelect">${i }</span>  
      </c:when>  
      <c:otherwise>  
        <a href="javascript:void(0)" onclick="SetRequest(${i })" class="aBtn">${i }</a>  
      </c:otherwise>  
   </c:choose>
   </c:forEach>
   
   <c:if test="${end < page.tp }">  
      <span class="spanApostrophe">...</span>  
    </c:if>
    
    <c:choose>  
    <c:when test="${page.pageNum eq page.tp }"><span class="spanBtnDisabled">下一页</span></c:when>  
    <c:otherwise><a href="javascript:void(0)"  onclick="SetRequest(${page.pageNum+1})" class="aBtn bold">下一页</a></c:otherwise>  
</c:choose>

<span>共${page.tp }页</span>
<!-- 分页 -->


            </div>
        </div>
    </div>

    <!--模态框
    -->
    
                  </div>
                  
              </div>
            </div>
          </div>
        
        <!-- footer content -->
        <footer>
          <div class="pull-right"> Studio - Bootstrap Admin Template by <a href="#">Colorlib</a></div>
          <div class="clearfix"></div>
        </footer> 
      </div>
   </div>

<Script language="javascript">
function GetQueryString(name)
{
     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if(r!=null)return  unescape(r[2]); return null;
}
function SetRequest(pageNum){
var url=window.location.href;
var s1 = url.split("?")[1];//获取后面参数名值，字符串
if(s1==null){//url不带参数
	window.location.href=url+"?pageNum="+pageNum;
	return;
}
url = url.split("?")[0]+"?";
var s2 = s1.split("&");//获取各个参数名和值字符串 like:   clazzId=1
var patt1=new RegExp("pageNum=");
for(var i=0;i<s2.length;i++){//将pageNum参数去掉
		if(patt1.test(s2[i])==false){
			url = url+s2[i]+"&";
		}
}

window.location.href=url+"pageNum="+pageNum;
}
</Script>

  </body>
</html>